package com.yxhl.zoume.utils;

import android.content.Context;

import com.yxhl.zoume.data.http.model.account.ZMAccount;

/**
 * 项目名称：Ferrari
 * Created by menggod on 16/11/10 .
 */
public class MobileTokenUtils {
    private volatile static MobileTokenUtils ourInstance;
    private static Context mContext;

    public static MobileTokenUtils getInstance(Context context) {
        mContext = context;
        if (ourInstance == null) {
            synchronized (MobileTokenUtils.class) {
                if (ourInstance == null) {
                    ourInstance = new MobileTokenUtils();
                }
            }
        }
        return ourInstance;
    }

    private MobileTokenUtils() {
    }

    public String getMobile() {
        String mobile = "";
        ZMAccount account = AccountUtils.getInstance(mContext).getAccount();
        if (account != null) {
            mobile = account.getAccountName();
        } else {
            mobile = "";
        }
        return mobile;
    }


    public String getToken() {
        String token = "";
        ZMAccount account = AccountUtils.getInstance(mContext).getAccount();
        if (account != null) {
            token = account.getAccessToken();
        } else {
            token = "";
        }
        return token;
    }

}